Class TournamentData

java.lang.Object
ddejonge.bandana.tournamentObserver.TournamentData
All Implemented Interfaces:
java.io.Serializable

public class TournamentData
extends java.lang.Object
implements java.io.Serializable
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    TournamentData​(int numParticipants, java.util.List<Team> teams, java.util.List<ScoreCalculator> scoreCalculators)  
  • Method Summary

    Modifier and Type Method Description
    void addResult​(GameResult newResult)
    Adds the results of a new game.
    java.util.List<GameResult> getGameResults()  
    java.util.List<java.lang.String> getPlayerNames()
    Returns the names of all the players that have so far participated in the tournament.
    java.util.List<ScoreCalculator> getScoreCalculators()  
    java.lang.String getScoreString​(Team team)  
    java.lang.String getScoreString​(java.lang.String teamName)  
    Team getTeamByName​(java.lang.String teamName)
    Returns the Team with the given teamName.
    java.util.List<Team> getTeams()  
    java.util.List<Team> getTeamsSorted()
    Returns the list of teams, sorted according to the scoreCalculators of this TournamentData object (the team with the best score will be first in the list).
    java.util.List<Team> getTeamsSorted​(java.util.List<ScoreCalculator> scoreCalculators)
    Returns the list of teams, sorted according to the given scoreCalculators (the team with the best score will be first in the list).
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TournamentData

      public TournamentData​(int numParticipants, java.util.List<Team> teams, java.util.List<ScoreCalculator> scoreCalculators)
      Parameters:
      numParticipants - The total number of participants in the tournament.
      teams - The list of teams for which we want to keep the scores. If null each player will be considered a team by itself.
      scoreCalculators -
  • Method Details

    • addResult

      public void addResult​(GameResult newResult)
      Adds the results of a new game. This will also automatically cause the ScoreCalculators to be updated with this result.
      Parameters:
      newResult -
    • getPlayerNames

      public java.util.List<java.lang.String> getPlayerNames()
      Returns the names of all the players that have so far participated in the tournament.
      Returns:
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getScoreString

      public java.lang.String getScoreString​(java.lang.String teamName)
    • getScoreString

      public java.lang.String getScoreString​(Team team)
    • getTeamsSorted

      public java.util.List<Team> getTeamsSorted()
      Returns the list of teams, sorted according to the scoreCalculators of this TournamentData object (the team with the best score will be first in the list).
      Returns:
    • getTeamsSorted

      public java.util.List<Team> getTeamsSorted​(java.util.List<ScoreCalculator> scoreCalculators)
      Returns the list of teams, sorted according to the given scoreCalculators (the team with the best score will be first in the list).
      Parameters:
      scoreCalculators -
      Returns:
    • getScoreCalculators

      public java.util.List<ScoreCalculator> getScoreCalculators()
    • getGameResults

      public java.util.List<GameResult> getGameResults()
    • getTeams

      public java.util.List<Team> getTeams()
    • getTeamByName

      public Team getTeamByName​(java.lang.String teamName)
      Returns the Team with the given teamName.
      Returns null if no such team is stored in this TournamentResult object.
      Parameters:
      teamName -
      Returns: